<template>
  <div>

    <!-- 多条件查询 -->
    <el-form ref="employee" :model="employee" label-width="80px" :inline="true">
      <el-form-item label="">
        <el-input v-model="employee.aname" placeholder="请输入公告名称"></el-input>
      </el-form-item>

      <el-form-item>
        <el-button type="success" plain @click="getALLEmployeeButton">查询</el-button>

      </el-form-item>
    </el-form>


    <!-- 新增按钮 -->
    <el-row class="right-aligned-button">
      <el-button type="danger" plain size="medium" @click="DelSelect">批量删除</el-button>
      <el-button type="danger" plain @click="showDa">添 加</el-button>
    </el-row>



    <!-- 表格 -->
    <el-table :data="pageBean.beanList" border style="width: 100%">

      <el-table-column prop="aid" label="编号" width="100">
      </el-table-column>
      <el-table-column prop="aname" label="公告名称" width="100">
      </el-table-column>

      <el-table-column prop="classfiy.ssname" label="分类">
      </el-table-column>


      <el-table-column prop="cellVo.cname" label="小区">
      </el-table-column>


      <el-table-column prop="starttime" label="发布时间">
      </el-table-column>


      <el-table-column prop="status" label="状态">
      </el-table-column>

      <el-table-column prop="content" label="内容">
      </el-table-column>



      <el-table-column prop="publisher" label="发布人">
      </el-table-column>

      <el-table-column prop="istop" label="是否置顶">
      </el-table-column>

      <!-- 操作 -->
      <el-table-column label="操作" width="150">
        <template slot-scope="scope">
          <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">修改</el-button>
          <el-button type="danger" plain size="small" @click="del(scope.row.sid)">删除</el-button>
        </template>
      </el-table-column>

    </el-table>

    <!-- 分页 -->
    <div class="block">
      <span class="demonstration"></span>
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageIndex"
        :page-sizes="[1, 2, 3 ]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
        :total="pageBean.totalRecord">
      </el-pagination>
    </div>



  </div>
</template>
<script>
  export default {
    data() {
      return {
        pageBean: {},
        pageIndex: 1,
        pageSize: 3,
        classfiy: [],
        employee: {},
      }
    },
    mounted() {
      this.getALLAdvertised();
      // this.getALLDepartment();
    },
    methods: {




      //按钮查询
      getALLEmployeeButton() {
        this.pageSize = 1
        this.getALLAdvertised();
      },
      handleSizeChange(val) {
        this.pageSize = val
        //重新查询
        this.getALLAdvertised()
      },
      //索引页改变
      //val是当前页码
      handleCurrentChange(val) {
        this.pageIndex = val
        this.getALLAdvertised()
      },
      getALLAdvertised(page) {
        this.$axios.post('/Advert/getAll/' + this.pageIndex + "/" + this.pageSize, this.employee).then(resp => {
          console.log(resp.data.data);
          this.pageBean = resp.data.data;

        })
      },
    }
  }

</script>
<style scoped>

</style>